package com.le.edu.controller;

import cn.hutool.core.util.IdUtil;
import com.le.edu.annotation.RedisLimitAnnotation;
import com.le.edu.resp.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Le
 * @create 2024-05-26 22:01
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/test")
public class TestController {

    @GetMapping("/redis/limit")
    @RedisLimitAnnotation(key = "redisLimit", permitsPerSecond = 3, expire = 1)
    public Result redisLimit() {
        String uuid = IdUtil.fastSimpleUUID();
        return Result.ok("正常业务返回，订单流水：" + uuid);
    }
}
